package com.orchard.orchardfarmmanagementsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.orchard.orchardfarmmanagementsystem.entity.InventorySupplier;
import com.orchard.orchardfarmmanagementsystem.entity.Supplier;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface InventorySupplierMapper extends BaseMapper<InventorySupplier> {
    @Update({
            "<script>",
            "UPDATE inventory_suppliers",
            "<set>",
            "  <if test='supplierId != null'>supplier_id = #{supplierId},</if>",
            "  <if test='purchaserName != null'>purchaser_name = #{purchaserName}</if>",
            "</set>",
            "WHERE inventory_id = #{inventoryId}",
            "</script>"
    })
    int updateByInventoryId(InventorySupplier inventorySupplier);
}